Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model/...: remove error parameter from decoders #3571

Merged
merged 2 commits into from
Mar 31, 2020

Conversation

axw
Copy link
Member

@axw axw commented Mar 30, 2020

Motivation/summary

Remove the input error parameter from the top-level model types' Decode functions. This is a non-idiomatic pattern which leads to less than ideal performance due to repeatedly checking errors rather than the idiomatic approach of checking once and bailing out early. The input error is always nil in practice for the modified decoders.

I've left the other decoders alone for now, as that's a much bigger change. We should address those as part of #3551.

Checklist

  • I have signed the Contributor License Agreement.
  • My code follows the style guidelines of this project (run make check-full for static code checks and linting)
  • I have rebased my changes on top of the latest master branch
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    - [ ] I have updated CHANGELOG.asciidoc

How to test these changes

make test

Related issues

None

This is non-idiomatic, unused, and promotes a code
pattern which leads to unnecessary CPU cycles.
@codecov-io
Copy link

Codecov Report

Merging #3571 into master will decrease coverage by 0.07%.
The diff coverage is 45.45%.

@@            Coverage Diff             @@
##           master    #3571      +/-   ##
==========================================
- Coverage   79.31%   79.23%   -0.08%     
==========================================
  Files         110      110              
  Lines        5873     5865       -8     
==========================================
- Hits         4658     4647      -11     
- Misses       1215     1218       +3     
Impacted Files Coverage Δ
model/error/event.go 96.70% <33.33%> (-0.03%) ⬇️
model/span/event.go 83.70% <33.33%> (-0.15%) ⬇️
model/transaction/event.go 91.26% <33.33%> (-0.14%) ⬇️
model/metricset/event.go 76.28% <100.00%> (+1.54%) ⬆️
processor/stream/processor.go 91.45% <100.00%> (ø)
kibana/connecting_client.go 64.51% <0.00%> (-8.07%) ⬇️

@axw axw merged commit 2b920d1 into elastic:master Mar 31, 2020
@axw axw deleted the idiomatic-error-handling branch March 31, 2020 02:48
axw added a commit to axw/apm-server that referenced this pull request Apr 8, 2020
This is non-idiomatic, unused, and promotes a code
pattern which leads to unnecessary CPU cycles.
axw added a commit that referenced this pull request Apr 8, 2020
This is non-idiomatic, unused, and promotes a code
pattern which leads to unnecessary CPU cycles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants